
#add path to pps libraries here
LIB_PPS=./lib

COMPILE_MODE=1

CXX=g++
CXXFLAGS=-O2 -g -m32
CFLAGS=-O2 -g -m32
LDFLAGS=-m32 -L$(LIB_PPS) -lppsbase -lppssg -lppsapi -lppsvodres -lppsfds -lppsvodnet

OBJFILE=xpps
OBJECTS=xpps.o ec_throw.o pps2tvod.o aes.o url.o

all:$(OBJFILE) libs
xpps:$(OBJECTS)
	$(CXX) $(CXXFLAGS) -o $(OBJFILE) $(OBJECTS) $(LDFLAGS)
.c.o:
	gcc $(CFLAGS) -c -o $@ $<
.cc.o:
	g++ $(CXXFLAGS) -c -o $@ $<

libs:ppswrapper-msgget.c
	gcc -shared -Wl,-ldl -o libppswrapper-preload.so.0.0.0 ppswrapper-msgget.c
	ln -s libppswrapper-preload.so.0.0.0 libppswrapper-preload.so.0.0
	ln -s libppswrapper-preload.so.0.0 libppswrapper-preload.so.0
	ln -s libppswrapper-preload.so.0 libppswrapper-preload.so
clean:
	rm -rf *.so* *.o xpps
install:
	cp xpps /usr/bin/
	mv libppswrapper-preload.* /usr/lib/
